package org.hamster.multidropbox.main.services
{
	import spark.components.supportClasses.TextBase;

	public class StatusBarService
	{
		private static var _instance:StatusBarService;
		public static function get instance():StatusBarService
		{
			if (_instance == null) {
				_instance = new StatusBarService();
			}
			return _instance;
		}
		
		public static function register(statusText:TextBase):void
		{
			instance.statusText = statusText;
		}
		
		public var infoColor:uint = 0xFFFFFF;
		public var warnColor:uint = 0xffa800;
		public var errorColor:uint = 0xFF0000;
		
		public var statusText:TextBase;
		
		public function info(text:String):void
		{
			this.message(text, infoColor);
		}
		
		public function warn(text:String):void
		{
			message(text, warnColor);
		}
		
		public function error(text:String):void
		{
			message(text, errorColor);	
		}
		
		public function message(text:String, textColor:int):void
		{
			if (textColor != -1) {
				statusText.setStyle('color', textColor);
			}
			statusText.text = text;
		}
		
	}
}